package com.siberhus.tdfl.processor;

import com.siberhus.tdfl.CancelException;
import com.siberhus.tdfl.Employee;
import com.siberhus.tdfl.FieldDataException;
import com.siberhus.tdfl.transform.FieldSet;

public class BreakDfp extends AbstractDataFileProcessor<Employee> {
	
	public int processItemCount = 0;
	public boolean onFinishExecuted = false;
	
	@Override
	public Employee mapLine(FieldSet fs, FieldDataException fde)
			throws Exception {
		return new Employee();
	}
	@Override
	public void validateItem(Employee item, FieldDataException fde)
			throws Exception {
		if(processItemCount==5){
			throw new CancelException("Trivial exception");
		}
	}
	@Override
	public void processItem(Employee item) throws Exception {
		processItemCount++;
	}
	@Override
	public void onFinish() {
		onFinishExecuted = true;
	}
	
	
}
